<template>
	<view>
		<view>
			<view>
				<view style="margin:20rpx 0 40rpx 100rpx;font-weight: 800;color:#0000FF;font-size: 46rpx;">全部信息
					<view class="leaveLine"></view>
				</view>
				
			</view>
			<view style="margin-top:80upx">
				<view v-for="(item,index) in leaveArr" :key="index">
					<view v-if="index%2" class="indexTeacher" @click="managementIndexSkip(item)">
						<view>{{item.buildingNo}}</view>
						<view>{{item.dormitoryNo}}</view>
						<view>{{item.createdTime}}</view>
						<view>详情</view>
					</view>
					<view v-else class="indexTeacher0" @click="managementIndexSkip(item)">
						<view>{{item.buildingNo}}</view>
						<view>{{item.dormitoryNo}}</view>
						<view>{{item.createdTime | showTime}}</view>
						<view>详情</view>
					</view>
				</view>
			</view>
			<view class="logoSty"></view>
		</view>
		
	</view>
</template>

<script>
	import topCom from '../component/topCom.vue'
	import bottomCom from '../component/bottom.vue'
	export default {
		data() {
			return {
				userName: '',
				topName: '值班巡查处理',
				leaveArr: [],
			}
		},
		filters:{
				showTime(str){
					var date = new Date();
					var year = date.getFullYear();
					var month = date.getMonth()+1;
					month = month>0 ?month:'0'+month;//个位数前面补零
					var day = date.getDate() >0 ? date.getDate() :'0'+date.getDate() ;
					return `${year}-${month}-${day}`
				}
		},
		components: {
			topCom,
			bottomCom
		},
		methods: {
			managementIndexSkip(item) {
				var str = JSON.stringify(item);
				if(item.patrolStatus=="1"){
					
				}
				uni.navigateTo({
					url: `/pages/classManagement/classManagdutyXq?str=` + str,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		},
		onShow() {
			var that = this
			uni.getStorage({
				key: 'loginName',
				success(res) {
					that.userName = res.data
				}
			})

			var loginId = uni.getStorageSync("loginId");

			this.$api.dormitory.findToDo(loginId).then(res => {
				console.log(res,121)
				this.leaveArr = res.data;
				console.log(this.leaveArr,555)
			})
			
		},
	}
</script>

<style>
	.indexTeacher {
		margin: auto;
		margin-top: 40upx;
		width: 605upx;
		height: 72upx;
		display: flex;
		justify-content: space-between;
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/T-4.png);
		background-size: 100%;
		color: white;
		padding: 30upx 20rpx 0rpx 20rpx;
		font-size: 22rpx;
		/* opacity: 0.8; */
	}

	.indexTeacher0 {
		margin: auto;
		margin-top: 40upx;
		width: 605upx;
		height: 72upx;
		display: flex;
		justify-content: space-between;
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/T-6.png);
		background-size: 100%;
		color: white;
		padding: 30upx 20rpx 0rpx 20rpx;
		font-size: 22rpx;
		/* opacity: 0.8; */
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
</style>
